home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 15 / CU Amiga Magazine's Super CD-ROM 15 (1997)(EMAP Images)(GB)[!][issue 1997-10].iso / CUCD / Graphics / Ghostscript / source / zsysvm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-16  |  4.0 KB  |  142 lines

  1. /* Copyright (C) 1994, 1995 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* zsysvm.c */
  20. /* System VM and VM-specific operators */
  21. #include "ghost.h"
  22. #include "oper.h"
  23. #include "ialloc.h"
  24. #include "ivmspace.h"
  25. #include "store.h"            /* for make_bool */
  26.  
  27. /*
  28.  * These operators allow creation of objects in a specific VM --
  29.  * local, global, or system.  System VM, which is not a standard PostScript
  30.  * facility, is not subject to save and restore; objects in system VM
  31.  * may only refer to simple objects or to other (composite) objects
  32.  * in system VM.
  33.  */
  34.  
  35. /* Execute an operator with a specific VM selected as current VM. */
  36. private int
  37. specific_vm_op(os_ptr op, int (*opproc)(P1(os_ptr)), uint space)
  38. {    uint save_space = icurrent_space;
  39.     int code;
  40.     ialloc_set_space(idmemory, space);
  41.     code = (*opproc)(op);
  42.     ialloc_set_space(idmemory, save_space);
  43.     return code;
  44. }
  45.  
  46. /* <int> .globalvmarray <array> */
  47. private int
  48. zglobalvmarray(os_ptr op)
  49. {    return specific_vm_op(op, zarray, avm_global);
  50. }
  51.  
  52. /* <int> .globalvmdict <dict> */
  53. private int
  54. zglobalvmdict(os_ptr op)
  55. {    return specific_vm_op(op, zdict, avm_global);
  56. }
  57.  
  58. /* <obj_0> ... <obj_n-1> <n> .globalvmpackedarray <packedarray> */
  59. private int
  60. zglobalvmpackedarray(os_ptr op)
  61. {    return specific_vm_op(op, zpackedarray, avm_global);
  62. }
  63.  
  64. /* <int> .globalvmstring <string> */
  65. private int
  66. zglobalvmstring(os_ptr op)
  67. {    return specific_vm_op(op, zstring, avm_global);
  68. }
  69.  
  70. /* <int> .localvmarray <array> */
  71. private int
  72. zlocalvmarray(os_ptr op)
  73. {    return specific_vm_op(op, zarray, avm_local);
  74. }
  75.  
  76. /* <int> .localvmdict <dict> */
  77. private int
  78. zlocalvmdict(os_ptr op)
  79. {    return specific_vm_op(op, zdict, avm_local);
  80. }
  81.  
  82. /* <obj_0> ... <obj_n-1> <n> .localvmpackedarray <packedarray> */
  83. private int
  84. zlocalvmpackedarray(os_ptr op)
  85. {    return specific_vm_op(op, zpackedarray, avm_local);
  86. }
  87.  
  88. /* <int> .localvmstring <string> */
  89. private int
  90. zlocalvmstring(os_ptr op)
  91. {    return specific_vm_op(op, zstring, avm_local);
  92. }
  93.  
  94. /* <int> .systemvmarray <array> */
  95. private int
  96. zsystemvmarray(os_ptr op)
  97. {    return specific_vm_op(op, zarray, avm_system);
  98. }
  99.  
  100. /* <int> .systemvmdict <dict> */
  101. private int
  102. zsystemvmdict(os_ptr op)
  103. {    return specific_vm_op(op, zdict, avm_system);
  104. }
  105.  
  106. /* <obj_0> ... <obj_n-1> <n> .systemvmpackedarray <packedarray> */
  107. private int
  108. zsystemvmpackedarray(os_ptr op)
  109. {    return specific_vm_op(op, zpackedarray, avm_system);
  110. }
  111.  
  112. /* <int> .systemvmstring <string> */
  113. private int
  114. zsystemvmstring(os_ptr op)
  115. {    return specific_vm_op(op, zstring, avm_system);
  116. }
  117.  
  118. /* <any> .systemvmcheck <bool> */
  119. private int
  120. zsystemvmcheck(register os_ptr op)
  121. {    make_bool(op, (r_space(op) == avm_system ? true : false));
  122.     return 0;
  123. }
  124.  
  125. /* ------ Initialization procedure ------ */
  126.  
  127. BEGIN_OP_DEFS(zsysvm_op_defs) {
  128.     {"1.globalvmarray", zglobalvmarray},
  129.     {"1.globalvmdict", zglobalvmdict},
  130.     {"1.globalvmpackedarray", zglobalvmpackedarray},
  131.     {"1.globalvmstring", zglobalvmstring},
  132.     {"1.localvmarray", zlocalvmarray},
  133.     {"1.localvmdict", zlocalvmdict},
  134.     {"1.localvmpackedarray", zlocalvmpackedarray},
  135.     {"1.localvmstring", zlocalvmstring},
  136.     {"1.systemvmarray", zsystemvmarray},
  137.     {"1.systemvmcheck", zsystemvmcheck},
  138.     {"1.systemvmdict", zsystemvmdict},
  139.     {"1.systemvmpackedarray", zsystemvmpackedarray},
  140.     {"1.systemvmstring", zsystemvmstring},
  141. END_OP_DEFS(0) }
  142.